package it.generali.model;
// Generated 14-gen-2014 15.39.15 by Hibernate Tools 3.6.0


import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Person generated by hbm2java
 */
@Entity
@Table(name="person"
    ,catalog="hibernate"
)
public class Person  implements java.io.Serializable {


     private Long personId;
     private Integer age;
     private String firstName;
     private String lastName;
     private Set<Events> eventses = new HashSet<Events>(0);
     private Set<PersonEmailAddr> personEmailAddrs = new HashSet<PersonEmailAddr>(0);

    public Person() {
    }

    public Person(Integer age, String firstName, String lastName, Set<Events> eventses, Set<PersonEmailAddr> personEmailAddrs) {
       this.age = age;
       this.firstName = firstName;
       this.lastName = lastName;
       this.eventses = eventses;
       this.personEmailAddrs = personEmailAddrs;
    }
   
     @Id @GeneratedValue(strategy=IDENTITY)

    
    @Column(name="PERSON_ID", unique=true, nullable=false)
    public Long getPersonId() {
        return this.personId;
    }
    
    public void setPersonId(Long personId) {
        this.personId = personId;
    }

    
    @Column(name="age")
    public Integer getAge() {
        return this.age;
    }
    
    public void setAge(Integer age) {
        this.age = age;
    }

    
    @Column(name="firstName")
    public String getFirstName() {
        return this.firstName;
    }
    
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    
    @Column(name="lastName")
    public String getLastName() {
        return this.lastName;
    }
    
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

@ManyToMany(fetch=FetchType.LAZY)
    @JoinTable(name="person_event", catalog="hibernate", joinColumns = { 
        @JoinColumn(name="PERSON_ID", nullable=false, updatable=false) }, inverseJoinColumns = { 
        @JoinColumn(name="EVENT_ID", nullable=false, updatable=false) })
    public Set<Events> getEventses() {
        return this.eventses;
    }
    
    public void setEventses(Set<Events> eventses) {
        this.eventses = eventses;
    }

@OneToMany(fetch=FetchType.LAZY, mappedBy="person")
    public Set<PersonEmailAddr> getPersonEmailAddrs() {
        return this.personEmailAddrs;
    }
    
    public void setPersonEmailAddrs(Set<PersonEmailAddr> personEmailAddrs) {
        this.personEmailAddrs = personEmailAddrs;
    }




}


